#include "helper/sqlite/DB.h"

#include <filesystem>
//#include <system_error>

namespace helper {
namespace sqlite {

DB::DB(const std::string & url)
: AbstractDB(url)
{
}
DB::~DB() {
}

bool DB::exists() const {
  if(isMemoryUrl(url())){
    return isOpened();   
  }
  else{
    return std::filesystem::exists(url());
  }
}
std::error_code DB::destroy() {
  auto && ec = AbstractDB::destroy();

  if(!isMemoryUrl(url())){
    std::filesystem::remove(url(), ec);
  }
  return ec;
}



}//namespace sqlite
}//namespace helper
